package GUI;

import java.util.ArrayList;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

import Control.Report_Control;
import Entity.ActivityReport;
import Entity.Activity_from_server;


public class ActivityRepChart_GUI extends ApplicationFrame {

    /**
	 * 
	 */
	
	private static final long serialVersionUID = 1L;

	/**
     * 
     * @param title  the frame title.
     */
    

	public ActivityRepChart_GUI(Integer[] arr) {
        super(" ");
      
        
        
         XYSeries series = new XYSeries("Requests per day");
         for(int i=0 ;i<arr.length;i++)
         {
        	 if(arr[i]==null){
        		 series.add(i, 0);
        	 }
        	 else{
        		    series.add(i, arr[i].intValue()); 
        	 }
    
        
         }
       
         XYSeriesCollection data = new XYSeriesCollection(series);
         JFreeChart chart = ChartFactory.createXYLineChart(
            "XY Activity  graph",
            "X", 
            "Y", 
            data,
            PlotOrientation.VERTICAL,
            true,
            true,
            false
        );

        final ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
        setContentPane(chartPanel);

    }

   
}
